package com.guan.ordering_sys.generator.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guan.ordering_sys.generator.entity.Account;
import com.guan.ordering_sys.generator.mapper.AccountMapper;
import com.guan.ordering_sys.generator.service.AccountService;
import com.guan.ordering_sys.param.AccountParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 林煜岚
 * @since 2021-06-23
 */
@Service
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements AccountService {

    @Autowired
    AccountMapper accountMapper;

    @Override
    public Account login(AccountParam accountParam) {
        Account account = accountMapper.selectAccountByAccountParam(accountParam);
        if (account != null) {
            return account;
        }
        return null;
    }

    @Override
    public int register(AccountParam accountParam) {
        int insertResult = 0;
        insertResult = accountMapper.insertAccount(accountParam);
        return insertResult;
    }

}
